



<div class="heading-buttons">
	<h3 class="glyphicons envelope">
		<i></i> Messages Report
	</h3>



</div>
<div class="separator"></div>




<div class="widget widget-2 widget-body-white finances_summary">
	<div class="widget-head">
		<h4 class="heading glyphicons envelope">
			<i></i> Messages Report
		</h4>


	</div>
	<div class="widget-body">
		<div class="row-fluid">


			<fieldset>
				<?php if($messages['all']){?>


				<div class="separator bottom">
					<div class="pull-right  margin-bottom">

						<form name="action" method="POST"
							action="<?=base_url(); ?>secure/reports/messages">
							<input type="text" name="search" placeholder="Search Message"> <!-- <select name="order"
								onchange="this.form.submit()">
								<option value="">-- Select --</option>
								<option value="search">Search</option>
								<option value="inactive">Inactive</option>
								<option value="active">Active</option>

							</select>
							 -->
						</form>

					</div>
				</div>

				<table class="table table-bordered table-striped" cellspacing='0'
					width="100%">
					<!-- Table Header -->
					<thead>
						<tr>
							<th width="15%">Name</th>
							<th width="15%">Email</th>
							<th width="15%">Posted On</th>
							<th width="25%">Description</th>
							<th width="5%">Status</th>
							<th width="30%">ACTION</th>
						</tr>
					</thead>
					<!-- Table Header -->
					<!-- Table Body -->
					<?php if($messages['all']){?>
					<?php foreach ($messages['all'] as $messages) : ?>
					<tr>
						<td><?= $messages->name;?></td>
						<td><?= $messages->email;?></td>
						<td><?= $messages->posted_on;?> 
						</td>
						<td align="center">On: <span class="text-error"><b><?= $this->admin_listing_model->get_business_name($messages->listing_id)->title;?>
							</b> </span>
							<br>
							<?= substr($messages->description,0,30);?>
						</td>
						
						<td>
						<div class="btn-group">
							   <?php if ($messages->status == 1) { ?>
							  	<a class="btn" href="<?= base_url(); ?>secure/reports/messages/change_message_status/<?= $messages->status;?>/<?= $messages->id; ?>" title="Inactive"><i class="icon-thumbs-down"></i></a>
							   	<?php } else { ?>
							   	<a class="btn" href="<?= base_url(); ?>secure/reports/messages/change_message_status/<?= $messages->status;?>/<?= $messages->id; ?>" title="Active"><i class="icon-thumbs-up"></i></a>
							   	 <?php } ?>
							  </div>
						</td>
						
						<td align="right">

							<div class="btn-group">
								<button class="btn btn-inverse dropdown-toggle"
									data-toggle="dropdown">
									Action<span class="caret"></span>
								</button>
								<ul class="dropdown-menu">


									<li><a href="<?= base_url();?>secure/reports/messages/message_view/<?= $messages->id;?>"
									<?php if($this->config->item('mode')=='DEMO'){?>
										onclick="alert ('Sorry! Demo mode '); return false;"
									<?} else?> onclick="return confirm('Are you sure ?');"><i
											class="icon-folder-open"></i> View</a></li>
									<li></li>
									<li><a href="<?= base_url();?>secure/reports/messages/delete_message/<?= $messages->id;?>"
									<?php if($this->config->item('mode')=='DEMO'){?>
										onclick="alert ('Sorry! Demo mode '); return false;"
									<?} else?> onclick="return confirm('Are you sure ?');"><i
											class="icon-minus"></i> Delete</a></li>

								</ul>
							</div>
						</td>
					</tr>
					<!-- Table Row -->
					<?php endforeach; 
}?>
					<?php }else { echo "No Data found....";
}?>
					</tbody>
					<!-- Table Body -->
				</table>
				<div class="pagination pull-right">
					<ul>
						<li><?php  echo $this->pagination->create_links(); ?>
						</li>
					</ul>
				</div>
			</fieldset>

		</div>

	</div>
</div>
